package tmall.common.dto;

import com.github.pagehelper.Page;
import tmall.common.vo.PageVO;

import java.io.Serializable;
import java.util.List;

/**
 * 保存返回给前端参数的DTO类
 *
 * @author zhangservlet
 * @date 2020/11/30
 */
public class PageDTO<T> extends PageVO implements Serializable {

    private long total;
    private int pages;
    private List<T> list;

    public PageDTO(long total, int pages, List<T> list) {
        this.total = total;
        this.pages = pages;
        this.list = list;
    }

    public PageDTO(Page page) {
        super.setPageNum(page.getPageNum());
        super.setPageSize(page.getPageSize());
        this.pages = page.getPages();
        this.total = page.getTotal();
        this.list = page;
    }

    public PageDTO() {
    }

    public long getTotal() {
        return total;
    }

    public void setTotal(long total) {
        this.total = total;
    }

    public int getPages() {
        return pages;
    }

    public void setPages(int pages) {
        this.pages = pages;
    }

    public List getList() {
        return list;
    }

    public void setList(List list) {
        this.list = list;
    }
}
